#ifndef __trochoidwedge__
#define __trochoidwedge__
if(token.Matches(_("p_trochoidwedge"))&&(T.GetCount()==9))
{
    IsNotExtFunc = false;

    double X1 = calc(T[0]);
    double Y1 = calc(T[1]);
    double X2 = calc(T[2]);
    double Y2 = calc(T[3]);
    double L1 = calc(T[4])/2;
    double L2 = calc(T[5])/2;
    double Ae = calc(T[6]);
    double R101 = calc(T[7]);
    double Z101 = calc(T[8]);

  /*  double  D = V[0];

    if((AER(X1,X2,0.001))&&(AER(Y1,Y2,0.001)))
    {
        ERR << _("NOTHING TO DO\n");
        break;
    };
    if(L2<0)
    {
        ERR << _("L2 Smaller than ZERO\n");
        break;
    };
    if( (L2*2)<(D+Ae+Ae))
    {
        ERR << _("Too big tool radius");
        break;
    };

    mPoint center = mP( -((L1/Ae)*(L1/2)-(Ae/2)),0.0);
    double  R = (((L1/Ae)*(L1/2))+(Ae/2))-(D/2); //R MAIN ARC..

    mChain CHAIN,EDGE;

    double Angle = mP(X1,Y1).GetDirectionXY(mP(X2,Y2));
    double  Dist = mP(X1,Y1).GetDistanceXY(mP(X2,Y2));

    EDGE.Add(cP(mP(0,-L1,Z101) , mP(NAN,NAN,NAN) ,1));
    EDGE.Add(cP(mP(Dist,-L2,Z101) , mP(NAN,NAN),0));

    mChain LIMIT = EDGE.Offset(-D/2);
    mChain ARCHAIN = EDGE.Offset(-((D/2)+Ae));

    mPointArray SP,MP,LP,HP;


    //****************

    eR(LIMIT.P1(0),LIMIT.P2(0)).Intersection(&SP,eR(  mP(-D,50,Z101),mP(-D,-50,Z101) ));
    //SP = Int_RayRay(LIMIT.P1(0),LIMIT.P2(0),mP(-D,50,Z101),mP(-D,-50,Z101));




    CHAIN.Add(  cP(SP.at(0),mP(NAN,NAN,NAN),1)   );

    //MP = Int_CircleRay(center,R-Ae,ARCHAIN.P1(0),ARCHAIN.P2(0));

    eC(center,R-Ae).Intersection(&MP,eR(ARCHAIN.P1(0),ARCHAIN.P2(0)));

    if(MP.size()==0)
    {
        ERR << _("ERROR MP1\n");
        break;
    }
    //LP = Int_CircleRay(MP.at(0),Ae+0.000000001,LIMIT.P1(0),LIMIT.P2(0));

    eC(MP.at(0),Ae+000000001).Intersection(&LP,eR(LIMIT.P1(0),LIMIT.P2(0)));


    if(LP.size()==0)
    {
        ERR << _("ERROR LP1\n");
        break;
    }
    HP.clear();
    //HP = Int_CircleCircle(MP.at(0),Ae,center,R-0.000000001);

    eC(MP.at(0),Ae).Intersection(&HP,eC(center,R-0.000000001));

    if(HP.size()==0)
    {
        ERR << _("ERROR HP1\n");
        break;
    }
    while(LP.at(0).x<Dist)
    {
        //MP = Int_CircleRay(center,R-Ae+0.0000000000001,ARCHAIN.P1(0),ARCHAIN.P2(0));
        MP.clear();
        eC(center,R-Ae+0.0000000000001).Intersection(&MP,eR(ARCHAIN.P1(0),ARCHAIN.P2(0)));

        if(MP.size()==0)
        {
            ERR << _("ERROR MP");
            break;
        }
        //LP = Int_CircleRay(MP.at(0),Ae+0.0000000001,LIMIT.P1(0),LIMIT.P2(0));
        LP.clear();
        eC(MP.at(0),Ae+0.0000000001).Intersection(&LP,eR(LIMIT.P1(0),LIMIT.P2(0)));

        if(LP.size()==0)
        {
            ERR << _("ERROR LP");
            break;
        }
        //HP = Int_CircleCircle(MP.at(0),Ae,center,R-0.00000000001);
        HP.clear();
        eC(MP.at(0),Ae).Intersection(&HP,eC(center,R-0.00000000001));
        if(HP.size()==0)
        {
            ERR << _("ERROR HP\n");
            break;
        }
            CHAIN.Add(cP( LP.at(0),MP.at(0),173));
            CHAIN.Add(cP(  HP.at(0) ,center,173));
            CHAIN.Add(cP(  mP(HP.at(0).x,-HP.at(0).y,HP.at(0).z) , mP(MP.at(0).x,-MP.at(0).y,MP.at(0).z) ,173));

        if(LP.at(0).x>Dist)break;
            CHAIN.Add(cP(mP(MP.at(0).x-Ae,-MP.at(0).y,MP.at(0).z)  ,  mP(NAN,NAN,NAN),1));
            CHAIN.Add(cP(mP(MP.at(0).x-Ae,MP.at(0).y,MP.at(0).z), MP.at(0) ,173));
            CHAIN.Add(cP( LP.at(0),MP.at(0),1));


        center.x += Ae;
    }
    CHAIN.Add(cP( mP(LP.at(0).x,-LP.at(0).y,LP.at(0).z), mP(NAN,NAN,NAN) ,1));
    CHAIN.Add(cP( mP(SP.at(0).x,-SP.at(0).y,Z101),mP(NAN,NAN,NAN),1));

    //MOVE
    CHAIN.RotateZ(Angle);
    CHAIN.Translate(mP(X1,Y1,0));

    CODE << CHAIN.CTG(R101,Z101);
    CHAIN.Clear();
    */
    continue;
}
#else
/*
INFO << _("p_trochoidwedge(x1,y1,x2,y2,L1,L2,Ae,R,Z)<BR>");
if(token.Matches(_("p_trochoidwedge(*")))
{
    INFO = _("p_trochoidwedge(x1,y1,x2,y2,L1,l2,Ae,R,Z)<BR>");
    return true;
}
*/
#endif

